package mamma.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import mamma.dao.sanghyoDao;
import mamma.vo.BabyInfoVo;
import mamma.vo.MemberVo;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class sanghyoAction extends ActionSupport {
	
	private int babynum;
	private String name;
	private String sex;
	private String borndate;
	private String bornweek;
	private String deliveryinfo;
	private String birthtype;
	private String birthlocation;
	private String memberEmail;
	
	
	private int headsize;
	private int height;
	private int weight;
	
	
	public String baby() throws Exception {
		System.out.println("아기 정보 입력 =================baby insert start");
		ActionContext context = ActionContext.getContext();
		Map<String, Object>session = (Map<String, Object>)context.getSession();
		MemberVo email = (MemberVo)session.get("login");
		memberEmail = email.getEmail();
		
		System.out.println("액션1111111111111111111111111111111111"+memberEmail);
		
		sanghyoDao dao = new sanghyoDao();
		BabyInfoVo babyInfo = new BabyInfoVo();
		
		System.out.println(borndate);
		
		babyInfo.setMemberemail(memberEmail);
		babyInfo.setName(name);
		babyInfo.setSex(sex);
		babyInfo.setBorndate(borndate);
		babyInfo.setBornweek(bornweek);
		babyInfo.setDeliveryinfo(deliveryinfo);
		babyInfo.setBirthtype(birthtype);
		babyInfo.setBirthlocation(birthlocation);
		
		babyInfo.setInputdate(borndate);
		babyInfo.setHeadsize(headsize);
		babyInfo.setHeight(height);
		babyInfo.setWeight(weight);
		
		
		System.out.println(babyInfo);
		dao.insertBaby(babyInfo);
		
		return SUCCESS;
		
	}
	
	
	/*public String babyInfo1() throws Exception {
		
		System.out.println("액션2222222222222222222222222222"+memberEmail);
		
		sanghyoDao dao = new sanghyoDao();
		BabyInfoVo babyInfo = new BabyInfoVo();
		
		System.out.println(borndate);
		
		babyInfo.setInputdate(borndate);
		babyInfo.setHeadsize(headsize);
		babyInfo.setHeight(height);
		babyInfo.setWeight(weight);
		
		System.out.println("baby action동작2 " + babyInfo);
		
		dao.insertBabyInfo(babyInfo);
		
		return SUCCESS;
		
	}*/


	public int getBabynum() {
		return babynum;
	}


	public void setBabynum(int babynum) {
		this.babynum = babynum;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getSex() {
		return sex;
	}


	public void setSex(String sex) {
		this.sex = sex;
	}


	public String getBorndate() {
		return borndate;
	}


	public void setBorndate(String borndate) {
		this.borndate = borndate;
	}


	public String getBornweek() {
		return bornweek;
	}


	public void setBornweek(String bornweek) {
		this.bornweek = bornweek;
	}


	public String getDeliveryinfo() {
		return deliveryinfo;
	}


	public void setDeliveryinfo(String deliveryinfo) {
		this.deliveryinfo = deliveryinfo;
	}


	public String getBirthtype() {
		return birthtype;
	}


	public void setBirthtype(String birthtype) {
		this.birthtype = birthtype;
	}


	public String getBirthlocation() {
		return birthlocation;
	}


	public void setBirthlocation(String birthlocation) {
		this.birthlocation = birthlocation;
	}


	public String getMemberEmail() {
		return memberEmail;
	}


	public void setMemberEmail(String memberEmail) {
		this.memberEmail = memberEmail;
	}


	public int getHeadsize() {
		return headsize;
	}


	public void setHeadsize(int headsize) {
		this.headsize = headsize;
	}


	public int getHeight() {
		return height;
	}


	public void setHeight(int height) {
		this.height = height;
	}


	public int getWeight() {
		return weight;
	}


	public void setWeight(int weight) {
		this.weight = weight;
	}

	
	
	
	

}
